<?php
include("./include.php"); 
//$tpl->assign('no', "hello");
$op=$_GET["op"];

$content = "";


if($op==1) //update
{
	$NewContent=$_POST["editor1"];
	$sql = "UPDATE `singlecontent` SET `content` = '$NewContent' WHERE `singlecontent`.`title` = 'about-us' LIMIT 1 ";
	$rs = &$conn->Execute($sql);

}
else //一般
{
	

}

$newsList = getContent($conn);

$tpl->assign("newsList",$newsList);
$tpl->display('news_add.html');


/*======以下為function============*/
function getContent($conn)
{
	$content_result="";
	$sql = "SELECT * FROM `news`";
	$rs = &$conn->Execute($sql);
	if($rs)
	{
		$content_result = $rs->getArray();
//		print_r($content_result);

	}
	
	return $content_result;
}

?>